﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;

namespace Ecreate.Popedom.Dao.Hibernate
{
    public class UserDaoImpl : IUserDao
    {




        public IList<tSysuser> getAllZero()
        {
            NHibernate.ISession s = Utility.getSession();
            return s.CreateQuery(" from tSysuser t where 1=1 and t.FLevel=0 ").List<tSysuser>();

        }
        public IList<tSysuser> getAllOne()
        {
            NHibernate.ISession s = Utility.getSession();
            return s.CreateQuery(" from tSysuser t where 1=1 and t.FLevel=1 ").List<tSysuser>();

        }
        public IList<tSysuser> getAllTwo()
        {
            NHibernate.ISession s = Utility.getSession();
            return s.CreateQuery(" from tSysuser t where 1=1 and t.FLevel=2 ").List<tSysuser>();
        }
        public IList<tSysuser> getAllThree()
        {
            NHibernate.ISession s = Utility.getSession();
            return s.CreateQuery(" from tSysuser t where 1=1 and t.FLevel=3 ").List<tSysuser>();
        }






        public IList<tSysuser> getAll()
        {
            NHibernate.ISession s=Utility.getSession();
            return s.CreateQuery(" from tSysuser t where 1=1 ").List<tSysuser>();
        }
        public tSysuser getById(string Id)
        {
            NHibernate.ISession s = Utility.getSession();
            return s.Get<tSysuser>(Id);
        }


        public void InsertUser(tSysuser model)
        {
            NHibernate.ISession s = Utility.getSession();
            s.Transaction.Begin();
            s.Save(model);
            s.Transaction.Commit();

        }
        public void DeleteUser(tSysuser model)
        {
            NHibernate.ISession s = Utility.getSession();
            s.Transaction.Begin();
            s.Delete(model);
            s.Transaction.Commit();
        }
        public void UpdateUser(tSysuser model)
        {
            NHibernate.ISession s = Utility.getSession();
            s.Transaction.Begin();
            s.Update(model);
            s.Transaction.Commit();
        }

    }
}
